package felix.things.router.mqtt.listener;

import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
import org.eclipse.paho.client.mqttv3.MqttMessage;

import java.nio.charset.StandardCharsets;

/**
 * @author Felix
 * @date 2019/7/27
 **/
@Slf4j
public class PrintMessageListener implements IMqttMessageListener {

    @Override
    public void messageArrived(String s, MqttMessage mqttMessage) {
        String data = new String(mqttMessage.getPayload(), StandardCharsets.UTF_8);
        log.debug("topic: 【{}】 ,data 【{}】", toString(), data);
    }

}
